<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>ulimit</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_010_229">&nbsp;</a>NAME</h4><blockquote>
ulimit - get and set process limits
</blockquote><h4><a name = "tag_000_010_230">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="ulimit.h.html">ulimit.h</a>&gt;

long int ulimit(int <i>cmd</i>, ...);
</code>
</pre>
</blockquote><h4><a name = "tag_000_010_231">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>ulimit()</i>
function provides for control over process limits.  The
<i>cmd</i>
values, defined in
<i><a href="ulimit.h.html">&lt;ulimit.h&gt;</a></i>
include:
<dl compact>

<dt>UL_GETFSIZE<dd>
Return the soft file size limit of the process.
The limit is in units of 512-byte blocks
and is inherited by child processes.
Files of any size can be read.
The return value is the integer part of the soft file size limit divided by
512.  If the result cannot be represented as a
<b>long int</b>,
the result is unspecified.

<dt>UL_SETFSIZE<dd>
Set the hard and soft file size limits for output operations of the
process to the value of the second argument, taken as a
<b>long int</b>.
Any process may decrease its own hard limit, but only a process with
appropriate privileges may increase the limit.
The new file size limit is returned.
The hard and soft file size limits are set to the specified value multiplied
by 512.  If the result would overflow an
<b>rlim_t</b>,
the actual value set is unspecified.

</dl>
<p>
The
<i>ulimit()</i>
function will not change the setting of 
<b>errno</b>
if successful.
</blockquote><h4><a name = "tag_000_010_232">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>ulimit()</i>
returns the value of the requested limit.  Otherwise -1 is returned and
<i>errno</i>
is set to indicate the error.
</blockquote><h4><a name = "tag_000_010_233">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>ulimit()</i>
function will fail and the limit will be unchanged if:
<dl compact>

<dt>[EINVAL]<dd>
The
<i>cmd</i>
argument is not valid.

<dt>[EPERM]<dd>
A process not having appropriate privileges attempts to increase its
file size limit.

</dl>
</blockquote><h4><a name = "tag_000_010_234">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_010_235">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
As all return values are permissible in a successful situation,
an application wishing to check for error situations should set
<i>errno</i>
to 0, then call
<i>ulimit()</i>,
and, if it returns -1, check to see if
<i>errno</i>
is non-zero.
</blockquote><h4><a name = "tag_000_010_236">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_010_237">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="getrlimit.html">getrlimit()</a></i>,
<i><a href="setrlimit.html">setrlimit()</a></i>,
<i><a href="write.html">write()</a></i>,
<i><a href="ulimit.h.html">&lt;ulimit.h&gt;</a></i>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from Issue 1 of the SVID.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

